package top.hcode.hoj.dao.course;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.hcode.hoj.mapper.LessonMapper;
import top.hcode.hoj.pojo.entity.course.Lesson;

/**
 * @author orangej
 * @since 2024/12/18
 */
@Service
public class LessonDao extends ServiceImpl<LessonMapper, Lesson> {

    public int getNextSortOrder(Long sectionId) {
        Integer max = baseMapper.getNextSortOrder(sectionId);
        return max == null ? 1 : max + 1;
    }

    public void refreshHandoutCount(Long lessonId) {
        baseMapper.refreshHandoutCount(lessonId);
    }

    public void refreshWorkCount(Long lessonId) {
        baseMapper.refreshWorkCount(lessonId);
    }
}
